#ifndef SENDMSG_H
#define SENDMSG_H

#include <QObject>
#include <QTcpSocket>
#include <QJsonDocument>
#include <QJsonObject>

class SendMsg : public QObject
{
    Q_OBJECT
public:
    explicit SendMsg(QObject *parent = nullptr);
    // ~SendMsg();
    void ConnectServer(QString ip, unsigned short port);

    void SendMessage(QJsonDocument doc);

    // void Working();

signals:
    void ConnectSuccessful();
    void ConnectFail();
    void ConnectOver();
    void ReceiveMessage(QByteArray msg);
    void ReconnectServer();

private:
    QTcpSocket* m_tcp = nullptr;
};

#endif // SENDMSG_H
